package com.javasm.springmybatis.mail;

import javax.websocket.Session;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.util.Properties;

/**
 * @Author：Drd
 * @Version：1.0
 * @Date：2021/12/29-15:54
 * @Since:jdk1.8
 * @Description:
 */
public class MailTest {
    public static void main(String[] args) {
        sendMail("Dr_dongruid@163.com","GFFJDUMNIWZGJIDO","3078242963@qq.com","呵呵呵呵");
    }

    private static void sendMail(String from, String password, String to, String content) {
        Properties properties = new Properties();

        properties.setProperty("mail.host", "smtp.163.com");

        properties.setProperty("mail.transport.protocol", "smtp");

        properties.setProperty("mail.smtp.auth", "true");
        properties.put("mail.smtp.ssl.enable", "true");

//        Session session=Session.getDefaultInstance(properties,new Authenticator(){
//            @Override
//                    protected PasswordAuthentication getPasswordAuthentication(){
//                return new PasswordAuthentication(from,password);
//            }
//        });
    }
}
